package com.carple.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.carple.dao.MemberDao;
import com.carple.dto.Member;



@WebServlet("/member/modifyform.action")
public class MemberModifyFormServlet extends HttpServlet{

	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		//로그인한 사용자 정보에서 email아이디를 축출하기

		
		
			HttpSession session = req.getSession(); //서블릿에서는 세션이 기본 객체가 아니므로 이렇게 뽑는다    --> 맨처음 이것만 썻는데....안됨..

//			session.getAttribute("loginuser");
			Member member = (Member)session.getAttribute("loginuser");
				
			
			
			//위에서 추출한 이메일 아이디로 데이터 조회기능

		
		


		//조회된 데이터를 jsp로 전달
		req.setAttribute("loginuser", member);
			
		
		RequestDispatcher dispatcher =
				req.getRequestDispatcher("/WEB-INF/views/member/modifyform.jsp");
		
			dispatcher.forward(req, resp);
	}
	
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		doGet(req, resp);
	}
	
}
